package com.info.zhiduoduo.core.dto.dayspay;

import com.info.zhiduoduo.common.constants.company.CompanyPayType;
import com.info.zhiduoduo.repository.entity.crowdsource.CrowdsourceTradeRecordItem;
import com.info.zhiduoduo.repository.entity.order.TradeRecord;
import com.info.zhiduoduo.repository.entity.partner.PartnerWithdraw;

import java.util.Date;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class DaysQueryAgentPayFormBean {

	/**  平台交易编号 */
	private String tradeNo;
	/** 第三方平台订单号 */
	private String partnerOrderNo;
	/** 交易时间 */
	private Date tradetime;
	/** 得仕商户号 1:九歌 2:武圣 3:智圣 */
	private int merchantId;

	public static DaysQueryAgentPayFormBean of(TradeRecord tradeRecord) {
		return new DaysQueryAgentPayFormBean().setTradeNo(tradeRecord.getTradeno())
				.setPartnerOrderNo(tradeRecord.getPartnerOrderNo())
				.setTradetime(tradeRecord.getTradetime())
				.setMerchantId(tradeRecord.getMerchantid());
	}

	public static DaysQueryAgentPayFormBean of(CrowdsourceTradeRecordItem recordItem, int merchantId) {
		return new DaysQueryAgentPayFormBean().setTradeNo(recordItem.getTradeNo())
				.setPartnerOrderNo(recordItem.getPartnerOrderNo())
				.setTradetime(recordItem.getTradetime())
				.setMerchantId(merchantId);
	}

	public static DaysQueryAgentPayFormBean of(PartnerWithdraw withdraw) {
		return new DaysQueryAgentPayFormBean().setTradeNo(withdraw.getWdno())
				.setPartnerOrderNo(withdraw.getPartnerOrderNo())
				.setTradetime(withdraw.getCreatetime())
				.setMerchantId(CompanyPayType.DAYS_JIUGE);
	}
}
